import 'package:json_annotation/json_annotation.dart';
import 'package:mall/modules/model/fill_in_order_entity.dart';

part 'order_list_entity.g.dart';

@JsonSerializable()
class OrderListEntity {
  int? total;
  int? pages;
  int? limit;
  int? page;
  List<OrderEntity>? list;

  OrderListEntity({
    this.total,
    this.pages,
    this.limit,
    this.page,
    this.list,
  });

  factory OrderListEntity.fromJson(Map<String, dynamic> json) => _$OrderListEntityFromJson(json);

  Map<String, dynamic> toJson() => _$OrderListEntityToJson(this);
}

@JsonSerializable()
class OrderEntity {
  String? orderStatusText;
  bool? isGroupin;
  String? orderSn;
  double? actualPrice;
  List<FillInOrderCheckedgoodslist>? goodsList;
  int? id;
  OrderListHandleoption? handleOption;

  OrderEntity({
    this.orderStatusText,
    this.isGroupin,
    this.orderSn,
    this.actualPrice,
    this.goodsList,
    this.id,
    this.handleOption,
  });

  factory OrderEntity.fromJson(Map<String, dynamic> json) => _$OrderEntityFromJson(json);

  Map<String, dynamic> toJson() => _$OrderEntityToJson(this);
}

// @JsonSerializable()
// class OrderGoodsEntity {
//   int? number;
//   String? picUrl;
//   double? price;
//   int? id;
//   String? goodsName;
//   List<String>? specifications;

//   OrderGoodsEntity({
//     this.number,
//     this.picUrl,
//     this.price,
//     this.id,
//     this.goodsName,
//     this.specifications,
//   });

//   factory OrderGoodsEntity.fromJson(Map<String, dynamic> json) => _$OrderGoodsEntityFromJson(json);

//   Map<String, dynamic> toJson() => _$OrderGoodsEntityToJson(this);
// }

@JsonSerializable()
class OrderListHandleoption {
  bool? cancel;
  bool? confirm;
  bool? rebuy;
  bool? pay;
  bool? comment;
  bool? delete;
  bool? refund;

  OrderListHandleoption({
    this.cancel,
    this.confirm,
    this.rebuy,
    this.pay,
    this.comment,
    this.delete,
    this.refund,
  });

  factory OrderListHandleoption.fromJson(Map<String, dynamic> json) => _$OrderListHandleoptionFromJson(json);

  Map<String, dynamic> toJson() => _$OrderListHandleoptionToJson(this);
}